#!/usr/bin/env bash

PREFIX=$(cd "$(dirname "$0")"; pwd)
cd $PREFIX
source config.sh
function dump {
mkdir -p table/$PSQL_DB
FILE=table/$PSQL_DB/$1.sql
pg_dump --no-owner --no-acl -s -n $1 -h $PSQL_HOST -U $PSQL_USER -p $PSQL_PORT -f $FILE $PSQL_DB
sed -i '/^-- .* version .*/d' $FILE
}

dump stock
